package com.vinxin.app.controller

import com.vinxin.app.model.ResponseModel
import com.vinxin.app.model.SelectorVo
import com.vinxin.app.service.StationService
import com.vinxin.app.utils.DataUtils
import jakarta.servlet.http.HttpServletRequest
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/station")
class StationController {
    @Autowired
    private lateinit var stationService: StationService

    @GetMapping("/list")
    fun getList(request: HttpServletRequest): ResponseModel<List<SelectorVo>> {
        return ResponseModel.ok(stationService.getList(DataUtils.map2HttpHeaders(DataUtils.extractHeaders(request))))
    }
}